import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: Java 程序设计第二次实验报告代码
 */
public class Test {
    //编程实现-3>>1和-3>>>1的结果显示
    public static void main9(String[] args) {
        System.out.println(-3>>1);
        System.out.println(-3>>>1);
    }

    //计算某年某月某日是该年的第几天
    public static void main8(String args[ ]) {
        Scanner scan = new Scanner(System.in);
        int[] MonthDay = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int total = 0;
        System.out.println("Please input year,month,day:");
        int year = scan.nextInt();
        int month = scan.nextInt();
        int day = scan.nextInt();
        for (int i = 1; i < month; i++) {
            if(i == 2) {
                if((year % 400 == 0) || (year % 100 != 0 && year % 4 == 0)) {
                    total += 1;
                }
            }
            total += MonthDay[i];
        }
        total += day;
        System.out.println(total);
    }

        //打印平行四边形的星星
    public static void main7(String[] args) {
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < i; j++) {
                System.out.print("   ");
            }
            System.out.println("*  *  *  *  *");
        }
    }

    //打印左下99乘法表
    public static void main(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                /*System.out.print(String.format("%-8s",i + "*" + j + "=" + i * j));*/
                System.out.printf("%d*%d=%-4d",i,j,i*j);
            }
            System.out.println();
        }
    }

    //3.打印水仙花数
    public static void main5(String[] args) {
        for (int i = 100; i < 1000; i++) {
            int sum = 0;
            int temp = i;
            while(temp != 0) {
                sum += (int)Math.pow(temp % 10, 3);
                temp /= 10;
            }
            if(sum == i) {
                System.out.print(i + " ");
            }
        }
    }

    //2.打印 1 - 100 的偶数
    public static void main4(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if(i % 2 == 0) {
                count++;
                System.out.print(i + " ");
                if(count != 0 && count % 5 == 0) {
                    System.out.println();
                }
            }
        }
    }

    //1.打印 10 - 50 的 3 的倍数的数
    public static void main3(String[] args) {
        for (int i = 10; i <= 50; i++) {
            if(i % 3 == 0) {
                System.out.print(i + " ");
            }
        }
    }

    public static void main2(String[] args) {
        int i = 10;
        do {
            if(i % 3 == 0) {
                System.out.print(i + " ");
            }
            i++;
        }while(i <= 50);
    }

    public static void main1(String[] args) {
        int i = 10;
        while(i <= 50) {
            if(i % 3 == 0) {
                System.out.print(i + " ");
            }
            i++;
        }
    }
}
